-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ci test error introduced by (#9781) #9838
Conversation
math.fabs(target[epoch] - param_group["lr"]) < 1e-5, | ||
flow.allclose( | ||
flow.tensor(target[epoch]), | ||
flow.tensor(param_group["lr"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里用 np.allclose 吧,不用创建新的 tensor,同理还有 145 行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
@@ -202,7 +201,9 @@ def _test_averaged_model(self, net_device, swa_device): | |||
averaged_dnn.update_parameters(dnn) | |||
|
|||
for p_avg, p_swa in zip(averaged_params, averaged_dnn.parameters()): | |||
self.assertTrue(flow.max(flow.abs(p_avg.cpu() - p_swa.cpu())).item() < 1e-5) | |||
self.assertTrue( | |||
flow.allclose(p_avg.cpu(), p_swa.cpu(), atol=1e-5, rtol=1e-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要 .cpu() 吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
flow.allclose
函数test_multiplicative_lr
(原来写了2个一样的)